package com.atguigu.springcloud.service.impl;

import org.springframework.stereotype.Service;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
@Service
public class TestServiceImpl  {

	 public String test1() {
		
		 return this.getClass().getName();
	 }
	 
	 @HystrixCommand(fallbackMethod = "test2_TimeOutHandler" , commandProperties = {
			 @HystrixProperty(name="execution.isolation.thread.timeoutInMilliseconds",value="4300")
	 })
	 public String test2() {
		try {
			Thread.sleep(4000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println("响应结果：");
		 return this.getClass().getName();
	 }
	 
	 public String test2_TimeOutHandler() {
		 return "响应超时";
	}
}
